#include <bits/stdc++.h>
using namespace std;
char s1[1000010], s2[1000010];
unsigned long long hs1[1000010], hs2[1000010], p[1000010];
unsigned long long geths(unsigned long long *hs, int l, int r) {
  r++;
  return hs[r] - hs[l] * p[r - l];
}
int d[1000010];
int f[1000010];
int g[1000010];
int main() {
  p[0] = 1;
  for (int i = 1; i < 1000010; ++i) p[i] = p[i - 1] * 31;
  scanf(" %s %s", s1, s2);
  int len1 = strlen(s1);
  int len2 = strlen(s2);
  hs1[0] = hs2[0] = 1;
  for (int i = 1; i <= len1; ++i)
    hs1[i] = hs1[i - 1] * 31 + (s1[i - 1] - 'a' + 1);
  for (int i = 1; i <= len2; ++i)
    hs2[i] = hs2[i - 1] * 31 + (s2[i - 1] - 'a' + 1);
  d[0] = 0;
  for (int i = 1; i <= len1; ++i) {
    d[i] = 0;
    if (i < len2) continue;
    if (geths(hs1, i - len2, i - 1) == geths(hs2, 0, len2 - 1)) {
      d[i] = (d[i] + g[i - len2] + i - len2 + 1) % 1000000007;
    } else
      d[i] = d[i - 1];
    f[i] = (f[i - 1] + d[i]) % 1000000007;
    g[i] = (g[i - 1] + f[i]) % 1000000007;
  }
  printf("%d\n", f[len1]);
}
