#include <bits/stdc++.h>
using namespace std;
const long long int inf = 9e18;
vector<long long int> z_array(string s) {
  vector<long long int> ans((int)((s).size()));
  ans[0] = -1;
  long long int l = 0, r = 0;
  for (long long int i = 1; i < s.size(); i++) {
    if (i > r) {
      l = i;
      r = i;
      while ((r < s.size()) && (s[r] == s[r - i])) {
        r++;
      }
      r--;
      ans[i] = r - l + 1;
    } else {
      long long int k = i - l;
      if (ans[k] + i <= r) {
        ans[i] = ans[k];
      } else {
        l = i;
        while ((r < s.size()) && (s[r] == s[r - i])) {
          r++;
        }
        r--;
        ans[i] = r - l + 1;
      }
    }
  }
  return ans;
}
int main() {
  string s, t;
  cin >> s >> t;
  long long int tsize = (int)((t).size());
  long long int ssize = (int)((s).size());
  string util = t + s;
  vector<long long int> match = z_array(util);
  long long int n = (int)((match).size());
  vector<long long int> dp1(n, 0), dp2(n, 0), sum(n, 0);
  for (int i = 2 * tsize - 1; i < (int)((match).size()); i++) {
    if (match[i - tsize + 1] < tsize) {
      dp1[i] = dp1[i - 1];
    } else {
      dp1[i] = sum[i - tsize] + i - tsize + 1 - (tsize) + 1;
    }
    dp2[i] = dp1[i - 1] + dp2[i - 1];
    sum[i] = sum[i - 1] + dp1[i] + dp2[i];
    dp1[i] %= 1000000007;
    dp2[i] %= 1000000007;
    sum[i] %= 1000000007;
  }
  cout << (dp1[(int)((match).size()) - 1] + dp2[(int)((match).size()) - 1]) %
              1000000007
       << "\n";
}
