#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
long long n, m;
char s[200005], t[200005];
long long hsh[200005];
long long pw[200005];
vector<long long> id;
long long dp[200005];
long long sum[200005];
signed main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  for (long long i = 1; i <= n; ++i)
    hsh[i] = (114514LL * hsh[i - 1] % 1000000007 + s[i]) % 1000000007;
  pw[0] = 1;
  for (long long i = 1; i <= n; ++i) pw[i] = 114514LL * pw[i - 1] % 1000000007;
  long long aim = 0;
  for (long long i = 1; i <= m; ++i)
    aim = (114514LL * aim % 1000000007 + t[i]) % 1000000007;
  for (long long i = 1; i + m - 1 <= n; ++i) {
    long long val =
        (hsh[i + m - 1] - 1LL * hsh[i - 1] * pw[m] % 1000000007 + 1000000007) %
        1000000007;
    if (val == aim) id.push_back(i);
  }
  dp[0] = 1;
  sum[0] = 1;
  for (long long i = 1; i <= n; ++i) {
    long long val =
        upper_bound(id.begin(), id.end(), i - m + 1) - id.begin() - 1;
    if (val == -1)
      dp[i] = 0;
    else {
      dp[i] = sum[id[val] - 1];
    }
    dp[i] += dp[i - 1];
    dp[i] %= 1000000007;
    sum[i] = sum[i - 1] + dp[i];
    sum[i] %= 1000000007;
  }
  writeln((dp[n] - 1 + 1000000007) % 1000000007);
  return 0;
}
