#include <bits/stdc++.h>
using namespace std;
char s[100005], p[100005];
int f[100005], n, m, c1[100005], c2[100005];
vector<int> G;
void get_f() {
  int i, j;
  f[0] = f[1] = 0;
  for (i = 1; i < m; i++) {
    j = f[i];
    while (j && p[i] != p[j]) j = f[j];
    f[i + 1] = (p[i] == p[j] ? j + 1 : 0);
  }
}
void kmp() {
  int i, j = 0;
  for (i = 0; i < n; i++) {
    while (j && s[i] != p[j]) j = f[j];
    if (p[j] == s[i]) j++;
    if (j == m) G.push_back(i);
  }
}
inline void upd(int &x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
}
int get1(int x) {
  if (x < -1) return 0;
  int sum = 0;
  x += 2;
  for (; x; x -= x & -x) upd(sum, c1[x]);
  return sum;
}
void add1(int x, int w) {
  x += 2;
  for (; x <= n; x += x & -x) upd(c1[x], w);
}
int get2(int x) {
  if (x < -1) return 0;
  int sum = 0;
  x += 2;
  for (; x; x -= x & -x) upd(sum, c2[x]);
  return sum;
}
void add2(int x, int w) {
  x += 2;
  for (; x <= n; x += x & -x) upd(c2[x], w);
}
int dp[100005];
int main() {
  int i, x, ans = 0;
  vector<int>::iterator it;
  scanf("%s%s", s, p);
  n = strlen(s);
  m = strlen(p);
  get_f();
  kmp();
  add1(-1, 1);
  add2(-1, 1 * (n + 1));
  for (i = 0; i < n; i++) {
    it = upper_bound(G.begin(), G.end(), i);
    if (it == G.begin()) {
      dp[i] = 0;
      continue;
    }
    x = *(it - 1) - m + 1;
    dp[i] = (get2(x - 1) - (long long)get1(x - 1) * (n - x) % 1000000007 +
             1000000007) %
            1000000007;
    upd(ans, dp[i]);
    add1(i, dp[i]);
    add2(i, (long long)dp[i] * (n - i) % 1000000007);
  }
  cout << ans << endl;
  return 0;
}
