#include <bits/stdc++.h>
using namespace std;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
long long inf = 1e18, MOD = 1e9 + 7;
long long add(long long a, long long b) { return (a + b) % MOD; }
vector<int> kmp(string str, string pat) {
  int m = pat.length();
  string s = pat + "#" + str;
  int n = s.length();
  vector<int> Z(n, 0);
  for (int i = 1; i < n; i++) {
    int j = Z[i - 1];
    while (j > 0 && s[i] != s[j]) j = Z[j - 1];
    if (s[i] == s[j]) j++;
    Z[i] = j;
  }
  vector<int> ret(n - m - 1, 0);
  for (int i = m + 1; i < n; i++) {
    ret[i - m - 1] = (Z[i] == m);
  }
  return ret;
}
void solve() {
  string s, t;
  cin >> s >> t;
  int n = s.length(), m = t.length();
  vector<int> in = kmp(s, t);
  vector<int> dp(n + 1, 0);
  vector<int> pre(n + 1, 0), prepre(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    if (in[i - 1]) {
      dp[i] = add(i - m + 1, prepre[i - m]);
    } else {
      dp[i] = dp[i - 1];
    }
    pre[i] = add(pre[i - 1], dp[i]);
    prepre[i] = add(prepre[i - 1], pre[i]);
  }
  cout << pre[n] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int ti = 1;
  for (int i = 1; i <= ti; i++) {
    solve();
  }
  return 0;
}
