#include <bits/stdc++.h>
void generarTabla(int kms[], char s[], int n) {
  int p = 1, c = 0;
  kms[0] = -1;
  while (p < n) {
    if (s[p] == s[c])
      kms[p++] = kms[c++];
    else {
      kms[p] = c;
      c = kms[c];
      while (c >= 0 && s[p] != s[c]) c = kms[c];
      p++;
      c++;
    }
  }
  kms[p] = c;
  return;
}
int buscar(short q[], char s[], char t[], int n, int m) {
  int j = 0, k = 0, l = 0;
  int kmp[m + 1];
  generarTabla(kmp, t, m);
  while (j < n) {
    q[j] = 0;
    if (s[j] == t[k]) {
      k++;
      if (k == m) {
        q[j]++;
        k = kmp[k];
        l++;
      }
      j++;
    } else {
      k = kmp[k];
      if (k < 0) {
        j++;
        k++;
      }
    }
  }
  return l;
}
int main() {
  int n = 0, m = 0;
  char s[100001], t[100001];
  scanf("%s %s", s, t);
  while (s[n] != '\0') n++;
  while (t[m] != '\0') m++;
  short g[n];
  long long f[n + 1], a[n + 1], rta, sum;
  buscar(g, s, t, n, m);
  rta = sum = a[0] = f[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (g[i - 1]) {
      f[i] = a[i - m] + i - m + 1;
      f[i] %= (long long)1e9 + 7LL;
      sum = f[i] + sum;
      sum %= (long long)1e9 + 7LL;
    } else {
      f[i] = f[i - 1];
      sum = f[i] + sum;
      sum %= (long long)1e9 + 7LL;
    }
    a[i] = sum + a[i - 1];
    a[i] %= (long long)1e9 + 7LL;
    rta += f[i];
    rta %= (long long)1e9 + 7LL;
  }
  printf("%I64d", rta);
  return 0;
}
