Hamed has recently found a string *t* and suddenly became quite fond of it. He spent several days trying to find all occurrences of *t* in other strings he had. Finally he became tired and started thinking about the following problem. Given a string *s* how many ways are there to extract *k* ≥ 1 non-overlapping substrings from it such that each of them contains string *t* as a substring? More formally, you need to calculate the number of ways to choose two sequences *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*k*</sub> and *b*<sub class="lower-index">1</sub>, *b*<sub class="lower-index">2</sub>, ..., *b*<sub class="lower-index">*k*</sub> satisfying the following requirements:
 -  *k* ≥ 1 -  <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/9787d50d9b7a3b6baffe4cb496df2248b003b17a.png" style="max-width: 100.0%;max-height: 100.0%;"/> -  <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/092ce460b67857d1ad157982f2234fb864faae89.png" style="max-width: 100.0%;max-height: 100.0%;"/> -  <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/c25caac60742ab6bf606b781e3f62be37a796eeb.png" style="max-width: 100.0%;max-height: 100.0%;"/> -  <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/99ce7829f1cda3a108cb995b136005e31e6f5582.png" style="max-width: 100.0%;max-height: 100.0%;"/>  *t* is a substring of string *s*<sub class="lower-index">*a*<sub class="lower-index">*i*</sub></sub>*s*<sub class="lower-index">*a*<sub class="lower-index">*i*</sub> + 1</sub>... *s*<sub class="lower-index">*b*<sub class="lower-index">*i*</sub></sub> (string *s* is considered as 1-indexed). 
As the number of ways can be rather large print it modulo 10<sup class="upper-index">9</sup> + 7.
Input consists of two lines containing strings *s* and *t* (1 ≤ |*s*|, |*t*| ≤ 10<sup class="upper-index">5</sup>). Each string consists of lowercase Latin letters.
MOD = 1000000007


def calculate_prefix_function(pattern):
    m = len(pattern)
    p = [0] * (m + 1)
    j = 0

    for i in range(2, m + 1):
        while j and pattern[j + 1] != pattern[i]:
            j = p[j]
        if pattern[j + 1] == pattern[i]:
            j += 1
        p[i] = j

    return p


def main():
    st1 = input().strip()
    n = len(st1)
    st2 = input().strip()
    m = len(st2)

    p = calculate_prefix_function(st2)

    j = 0
    s = [0] * (n + 1)
    d = [0] * (n + 1)

    for i in range(1, n + 1):
        while j > 0 and st2[j + 1] != st1[i]:
            j = p[j]
        if st2[j + 1] == st1[i]:
            j += 1
        if j == m:
            s[i] = 1
            j = p[j]
        d[i] = i - m + 1 if s[i] else d[i - 1]

    dp = [0] * (n + 1)
    f = [0] * (n + 1)
    ss = [0] * (n + 1)

    dp[0] = 1
    f[0] = 1
    ss[0] = 0

    for i in range(1, n + 1):
        if not d[i]:
            dp[i] = 0
        else:
            dp[i] = ((1 * d[i] * f[d[i] - 1] - ss[d[i] - 1]) % MOD + MOD) % MOD
        f[i] = (f[i - 1] + dp[i]) % MOD
        ss[i] = (ss[i - 1] + 1 * dp[i] * i) % MOD

    result = ((f[n] - 1) % MOD + MOD) % MOD
    print(result)


if __name__ == "__main__":
    main()
