#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;
const int N = 3e5 + 10;
int n, z[N], a[N], mark[N], S[N], SS[N];
string s, t;
void zf(string s) {
  int l = 0, r = 0, k;
  z[0] = 0;
  for (int i = 1; i < s.size(); i++) {
    if (i > r) {
      l = r = i;
      while (s[r] == s[r - l] && r < s.size()) r++;
      z[i] = r - l, r--;
    } else {
      k = i - l;
      if (z[k] < r - i)
        z[i] = z[k];
      else {
        l = i;
        while (s[r] == s[r - l] && r < s.size()) r++;
        z[i] = r - l, r--;
      }
    }
  }
}
void process(string &s, string &t) {
  string r;
  r = t.substr(1, t.size() - 1) + "#" + s.substr(1, s.size() - 1);
  zf(r);
  for (int i = t.size(); i < r.size(); i++)
    if (z[i] == t.size() - 1) mark[i - 1] = 1;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie();
  cin >> s >> t;
  s = " " + s, t = " " + t;
  process(s, t);
  int ans = 0, cur = 0;
  for (int i = 1; i < s.size(); i++) {
    ;
    if (mark[i]) cur = (SS[i - t.size() + 1] + i - t.size() + 2) % MOD1;
    ans = (ans + cur) % MOD1;
    S[i] = (S[i - 1] + cur) % MOD1;
    SS[i] = (SS[i - 1] + S[i]) % MOD1;
  }
  cout << ans << "\n";
}
