#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int maxn = 100010;
const int mod = 1000000007;
char s[maxn];
char t[maxn];
int n, m;
int b[maxn];
bool flag[maxn];
void preprocess() {
  int i = 0, j = -1;
  b[0] = -1;
  while (i < m) {
    while (j >= 0 && t[i] != t[j]) j = b[j];
    i++;
    j++;
    b[i] = j;
  }
}
void search() {
  int i = 0, j = 0;
  while (i < n) {
    while (j >= 0 && s[i] != t[j]) j = b[j];
    i++;
    j++;
    if (j == m) {
      flag[i - j + m - 1] = 1;
      j = b[j];
    }
  }
}
long long f[maxn];
long long g[maxn];
long long h[maxn];
void solve() {
  memset(flag, 0, sizeof(flag));
  memset(f, 0, sizeof(f));
  memset(g, 0, sizeof(g));
  memset(h, 0, sizeof(h));
  scanf("%s%s", s, t);
  n = strlen(s);
  m = strlen(t);
  preprocess();
  search();
  int prev = -1;
  for (int i = 0; i < n; i++) {
    f[i] = f[(i + n) % (n + 1)];
    if (flag[i]) {
      if (i >= m) {
        if (prev == -1)
          f[i] = (f[i] + g[i - m]) % mod;
        else if (i - m >= prev)
          f[i] = (f[i] + h[i - m] - h[(prev + n) % (n + 1)] + mod) % mod;
      }
      f[i] = (f[i] + i - m + 1 - prev) % mod;
      prev = i - m + 1;
    }
    g[i] = (g[(i + n) % (n + 1)] + f[i]) % mod;
    h[i] = (h[(i + n) % (n + 1)] + g[i]) % mod;
  }
  printf("%I64d", g[n - 1]);
}
int main() {
  solve();
  return 0;
}
