#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 10, N = 2e6 + 10, mod = 1e9 + 7, LG = 20, SQ = 450;
long long n, T[N], L[N], dp[N], ps[N];
inline void KMP(string s) {
  long long k = -1;
  T[0] = -1;
  for (int i = 1; i < s.size(); i++) {
    while (k != -1 and s[k + 1] != s[i]) k = T[k];
    if (s[k + 1] == s[i]) k++;
    T[i] = k;
  }
}
string s, t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> t;
  n = s.size();
  KMP(t + "#" + s);
  for (int i = t.size() + 1; i < s.size() + t.size() + 1; i++)
    T[i - t.size() - 1] = T[i] + 1;
  L[0] = -1;
  for (int i = 0; i < n; i++) {
    L[i + 1] = L[i];
    if (T[i] == t.size()) L[i + 1] = i - t.size() + 1;
  }
  dp[0] = 1;
  ps[0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    if (L[i] > -1) dp[i] = (ps[L[i]] + dp[i]) % mod;
    ps[i] = (ps[i - 1] + dp[i]) % mod;
  }
  cout << ((dp[n] + mod - 1) % mod);
}
