#include <bits/stdc++.h>
using namespace std;
const int mod = int(1e9) + 7;
vector<int> Find(string s, string t) {
  string w = t + "$" + s;
  vector<int> p(w.size()), ans;
  for (int i = 1; i < w.size(); ++i) {
    int j = p[i - 1];
    while (j > 0 && w[j] != w[i]) j = p[j - 1];
    if (w[j] == w[i]) p[i] = j + 1;
    if (p[i] == t.size()) {
      ans.push_back(i - t.size() - 1);
    }
  }
  return ans;
}
int main() {
  string s, t;
  cin >> s >> t;
  vector<int> pos = Find(s, t);
  vector<int> d(s.size()), sumd(s.size());
  for (int i = 0; i < s.size(); ++i) {
    if (i > 0) d[i] = d[i - 1];
    int j = upper_bound(pos.begin(), pos.end(), i) - pos.begin();
    j--;
    if (j >= 0) {
      j = pos[j];
      int k = j - t.size();
      d[i] = (d[i] + k + 2) % mod;
      if (k >= 0) d[i] = (d[i] + sumd[k]) % mod;
    }
    sumd[i] = d[i];
    if (i > 0) sumd[i] = (sumd[i - 1] + sumd[i]) % mod;
  }
  cout << d.back() << endl;
  return 0;
}
