#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T &x, T y) {
  x = x > y ? x : y;
}
template <typename T>
void chkmin(T &x, T y) {
  x = x > y ? y : x;
}
template <typename T>
void add(T &x, T y, T mod) {
  x = x + y > mod ? x + y - mod : x + y;
}
template <typename T>
void sub(T &x, T y, T mod) {
  x = x - y < 0 ? x - y + mod : x - y;
}
template <typename T>
void multi(T &x, T y, T mod) {
  x = 1ll * x * y % mod;
}
const int INF = (1ll << 30) - 1;
template <typename T>
void read(T &x) {
  x = 0;
  bool f = 1;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = 0;
  } while (ch > '9' || ch < '0');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  x = f ? x : -x;
}
template <typename T>
void write(T x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int N = 1e5 + 7;
const int mod1 = 998244353;
const int mod2 = 1e9 + 7;
const int p = 29;
int n, m, f[N], sum[N], sum2[N];
pair<long long, long long> pw[N], Hash[N];
bool flag[N];
char s[N], t[N];
inline void init() {
  pw[0].first = pw[0].second = 1;
  for (int i = 1; i <= n; i++) {
    pw[i].first = pw[i - 1].first * p % mod1;
    pw[i].second = pw[i - 1].second * p % mod2;
  }
}
inline pair<long long, long long> get(int l, int r) {
  return make_pair(
      (Hash[r].first - Hash[l - 1].first * pw[r - l + 1].first % mod1 + mod1) %
          mod1,
      (Hash[r].second - Hash[l - 1].second * pw[r - l + 1].second % mod2 +
       mod2) %
          mod2);
}
int main() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  Hash[0].first = Hash[0].second = 0;
  init();
  for (int i = 1; i <= n; i++) {
    Hash[i].first = (Hash[i - 1].first * p % mod1 + (s[i] - 'a') % mod1) % mod1;
    Hash[i].second =
        (Hash[i - 1].second * p % mod2 + (s[i] - 'a') % mod2) % mod2;
  }
  pair<long long, long long> now;
  now.first = now.second = 0;
  for (int i = 1; i <= m; i++) {
    now.first = (now.first * p % mod1 + t[i] - 'a') % mod1;
    now.second = (now.second * p % mod2 + t[i] - 'a') % mod2;
  }
  for (int i = m; i <= n; i++) {
    if (get(i - m + 1, i) == now) flag[i] = true;
  }
  for (int i = 1; i <= n; i++) {
    if (!flag[i])
      f[i] = f[i - 1];
    else {
      f[i] = (i - m + 1 + sum2[i - m]) % mod2;
    }
    sum[i] = (sum[i - 1] + f[i]) % mod2;
    sum2[i] = (sum2[i - 1] + sum[i]) % mod2;
  }
  printf("%d\n", sum[n]);
  return 0;
}
