#include <bits/stdc++.h>
using namespace std;
int f[100005];
string s, p;
vector<bool> loc;
void build() {
  f[0] = 0;
  int l = 0;
  for (int i = 1; i < p.size(); ++i) {
    while (l && p[i] != p[l]) l = f[l - 1];
    if (p[i] == p[l]) ++l;
    f[i] = l;
  }
}
void calc() {
  int l = 0;
  for (int i = 0; i < s.size(); ++i) {
    while (l && s[i] != p[l]) l = f[l - 1];
    if (s[i] == p[l]) ++l;
    if (l == p.size()) {
      loc[i - l + 1] = true;
      l = f[l - 1];
    }
  }
}
const int M = 1000000007;
int dp[100001][2];
vector<int> v;
int calc(int i, bool o) {
  if (i == s.size()) {
    return 1;
  }
  int &ret = dp[i][o];
  if (ret != -1) return ret;
  ret = 0;
  if (o) {
    ret = calc(i + 1, true);
    if (f) {
      ret += calc(i, false);
      ret %= M;
    }
  } else {
    ret = calc(i + 1, false);
    int x = lower_bound(v.begin(), v.end(), i) - v.begin();
    if (x != v.size()) {
      ret += calc(v[x] + p.size(), true);
      ret %= M;
    }
  }
  return ret;
}
int main() {
  cin >> s >> p;
  loc.resize(s.size(), false);
  memset(dp, -1, sizeof(dp));
  build();
  calc();
  for (int i = 0; i < s.size(); ++i)
    if (loc[i]) v.push_back(i);
  int res = calc(0, 0);
  res = (res - 1) % M;
  res = (res + M) % M;
  printf("%d\n", res);
  return 0;
}
