#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
long long f[200009], dp[200009][2];
int main() {
  string s, t;
  cin >> s >> t;
  int m = t.size();
  t += '#';
  t += s;
  for (int i = 1; i < t.size(); i++) {
    int j = f[i - 1];
    while (j > 0 and t[i] != t[j]) j = f[j - 1];
    j += (t[i] == t[j]);
    f[i] = j;
  }
  int d = 0, ind;
  for (int i = m + 1; i < t.size(); i++) {
    if (f[i] == m) d = 1, ind = i - m;
    if (d) {
      dp[i][0] = ((ind - m + 1) + dp[i - 1][0] + dp[ind][1]) % 1000000007;
      dp[i][1] = (dp[i][0] + dp[i - 1][1]) % 1000000007;
    }
  }
  cout << dp[t.size() - 1][0] << endl;
  return 0;
}
