#include <bits/stdc++.h>
using namespace std;
int ls, lt;
char s[100005], t[100005];
int fail[100005], cur[26];
bool match[100005];
int a[100005], s1[100005], s2[100005];
int main() {
  scanf("%s\n%s", s, t);
  ls = strlen(s);
  lt = strlen(t);
  memset(fail, -1, sizeof(fail));
  memset(cur, -1, sizeof(cur));
  int j = -1;
  for (int i = 1; i < lt; i++) {
    while (j >= 0 && t[j + 1] != t[i]) j = fail[j];
    if (t[j + 1] == t[i]) j++;
    fail[i] = j;
  }
  memset(match, 0, sizeof(match));
  j = -1;
  for (int i = 0; i < ls; i++) {
    while (j >= 0 && t[j + 1] != s[i]) j = fail[j];
    if (t[j + 1] == s[i]) j++;
    if (j == lt - 1) {
      j = fail[j];
      match[i] = true;
    }
  }
  for (int i = 0; i < ls; i++) a[i] = s1[i] = s2[i] = 0;
  for (int i = 0; i < ls; i++) {
    if (!match[i])
      a[i] = a[i - 1];
    else {
      int pv = i - lt;
      if (pv >= 0) {
        a[i] = (pv + 2 + s2[pv]) % 1000000007;
      } else
        a[i] = 1;
    }
    s1[i] = s1[i - 1] + a[i];
    s1[i] %= 1000000007;
    s2[i] = s2[i - 1] + s1[i];
    s2[i] %= 1000000007;
  }
  printf("%d\n", s1[ls - 1]);
  return 0;
}
