#include <bits/stdc++.h>
using namespace std;
const int DIM = 1e5 + 5;
const int MOD = 1e9 + 7;
int dp[DIM], pos[DIM], pre[DIM], psm[DIM], psm2[DIM];
char str1[DIM], str2[DIM];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cin >> (str1 + 1) >> (str2 + 1);
  int n = (int)strlen(str1 + 1);
  int m = (int)strlen(str2 + 1);
  for (int i = 2, l = 0; i <= m; i++) {
    while (l && str2[i] != str2[l + 1]) l = pre[l];
    if (str2[i] == str2[l + 1]) l++;
    pre[i] = l;
  }
  dp[0] = psm[0] = psm2[0] = 1;
  for (int i = 1, l = 0; i <= n; i++) {
    while (l && str1[i] != str2[l + 1]) l = pre[l];
    if (str1[i] == str2[l + 1]) l++;
    pos[i] = pos[i - 1];
    if (l == m) {
      pos[i] = i - l + 1;
      l = pre[l];
    }
    if (pos[i] != 0) dp[i] = psm2[pos[i] - 1];
    psm[i] = (psm[i - 1] + dp[i]) % MOD;
    psm2[i] = (psm2[i - 1] + psm[i]) % MOD;
  }
  cout << (psm[n] - 1 + MOD) % MOD;
  return 0;
}
