#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 2;
const long long infl = ~0LLU >> 2;
template <class T>
inline void Min(T &x, T y) {
  if (y < x) x = y;
}
template <class T>
inline void Max(T &x, T y) {
  if (y > x) x = y;
}
const int mod = 1e9 + 7;
const int inv2 = mod + 1 >> 1;
inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) {
  x -= y;
  if (x < 0) x += mod;
}
inline int Mul(int x, int y) { return (int)((long long)x * y % mod); }
inline int Mul(int x, int y, int z) { return Mul(x, Mul(y, z)); }
int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1, x = Mul(x, x)) {
    if (y & 1) z = Mul(z, x);
  }
  return z;
}
inline int Inv(int x) { return Pow(x, mod - 2); }
inline int Fix(long long x) {
  x %= mod;
  if (x < 0) x += mod;
  return (int)x;
}
inline int Fix(int x) {
  x %= mod;
  if (x < 0) x += mod;
  return x;
}
const int maxn = 1e5;
int n, m;
char s[maxn + 1];
char t[maxn + 1];
int border[maxn + 1];
bool occur[maxn + 1];
int f[maxn + 1], sumf[maxn + 2];
int g[maxn + 1];
void Solve(void) {
  f[0] = 1;
  sumf[0] = 0;
  sumf[1] = 1;
  g[0] = 0;
  int sum_g = 0;
  int last = -1;
  for (int i = 1; i <= n; ++i) {
    if (i - m >= 0 && occur[i - m]) last = i - m;
    if (last == -1) {
      g[i] = 0;
    } else {
      g[i] = sumf[last + 1];
    }
    Add(sum_g, g[i]);
    f[i] = Add(sum_g + 1);
    sumf[i + 1] = Add(sumf[i] + f[i]);
  }
  printf("%d\n", sum_g);
}
int main(void) {
  scanf("%s%s", s, t);
  n = strlen(s);
  m = strlen(t);
  border[0] = border[1] = 0;
  int cur = 0;
  for (int i = 1; i < m; ++i) {
    while (cur > 0 && t[i] != t[cur]) {
      cur = border[cur];
    }
    if (t[i] == t[cur]) ++cur;
    border[i + 1] = cur;
  }
  cur = 0;
  for (int i = 0; i < n; ++i) {
    while (cur > 0 && s[i] != t[cur]) {
      cur = border[cur];
    }
    if (s[i] == t[cur]) ++cur;
    if (cur == m) {
      occur[i - m + 1] = true;
      cur = border[cur];
    }
  }
  Solve();
}
