#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  bool present[s.length()];
  int n = s.length();
  for (int i = 0; i < n; i++) {
    present[i] = false;
  }
  int cur = 0;
  while (cur < s.length()) {
    int temp = s.find(t, cur);
    if (temp == -1) break;
    present[temp] = true;
    cur = temp + 1;
  }
  long long ans[s.length()], sum[s.length()], sums[s.length()];
  int prev[s.length()];
  int cc = -1;
  for (int i = 0; i < s.length(); i++) {
    if (i >= t.length() - 1 && present[i - t.length() + 1])
      cc = i - t.length() + 1;
    prev[i] = cc;
  }
  for (int i = 0; i < s.length(); i++) {
    ans[i] =
        (((prev[i] > 0) ? sums[prev[i] - 1] : 0) + (prev[i] + 1)) % 1000000007;
    sum[i] = (((i > 0) ? sum[i - 1] : 0) + ans[i]) % 1000000007;
    sums[i] = (((i > 0) ? sums[i - 1] : 0) + sum[i]) % 1000000007;
  }
  cout << sum[s.length() - 1] << endl;
  return 0;
}
