#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int mod = 1e9 + 7;
string a, b;
int nxt[N];
bool flag[N];
int last[N];
long long dp[N], sum[N];
void kmp() {
  string c = b + "$" + a;
  nxt[0] = -1;
  for (int i = 1, j = -1; i < c.length(); ++i) {
    while (j != -1 && c[j + 1] != c[i]) j = nxt[j];
    if (c[j + 1] == c[i]) j++;
    nxt[i] = j;
    if (nxt[i] + 1 == b.length()) {
      flag[i - b.length()] = true;
    }
  }
}
int main() {
  cin >> a >> b;
  kmp();
  for (int i = 1, j = 0; i <= a.length(); ++i) {
    if (flag[i])
      last[i] = i - b.length(), j = i;
    else if (j)
      last[i] = last[i - 1];
    else
      last[i] = -1;
  }
  sum[0] = 1;
  for (int i = 1; i <= a.length(); ++i) {
    if (last[i] != -1)
      dp[i] = sum[last[i]];
    else
      dp[i] = 0;
    dp[i] = (dp[i] + dp[i - 1]) % mod;
    sum[i] = (sum[i - 1] + dp[i] + 1) % mod;
  }
  cout << dp[a.length()] << endl;
  return 0;
}
