#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int MOD = 1e9 + 7;
string s, t;
int b[N], ok[N], dp[N], sum1[N], sum2[N];
void preprocess(int m) {
  b[0] = b[1] = 0;
  for (int i = 2; i <= m; i++) {
    b[i] = b[i - 1];
    while (b[i] > 0 && t[b[i]] != t[i - 1]) b[i] = b[b[i]];
    if (t[b[i]] == t[i - 1]) b[i]++;
  }
}
void kmp(int n, int m) {
  int k = 0;
  for (int i = 0; i < n; i++) {
    while (k > 0 && t[k] != s[i]) k = b[k];
    k += (t[k] == s[i]);
    if (k == m) {
      ok[i] = 1;
      k = b[k];
    }
  }
}
int main() {
  cin >> s >> t;
  int n = s.length(), m = t.length();
  memset(ok, 0, sizeof(ok));
  preprocess(m);
  kmp(n, m);
  sum1[0] = 0;
  sum2[0] = 1;
  dp[0] = 1;
  for (int j = 1; j <= n; j++) {
    if (ok[j - 1])
      sum1[j] = sum2[j - m];
    else
      sum1[j] = sum1[j - 1];
    dp[j] = (dp[j - 1] + sum1[j]) % MOD;
    sum2[j] = (sum2[j - 1] + dp[j]) % MOD;
  }
  printf("%d\n", (dp[n] - 1 + MOD) % MOD);
  return 0;
}
