#include <bits/stdc++.h>
using namespace std;
const char IO_MODE = 0;
inline long long ReadInt() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void WriteInt(long long x) {
  char CH[20];
  if (x < 0) putchar('-');
  x = -x;
  int Num = 0;
  if (!x) {
    putchar('0');
    return;
  }
  while (x > 0) CH[++Num] = x % 10, x /= 10;
  while (Num) putchar(CH[Num--] + 48);
}
inline void out(int x) {
  if (IO_MODE & 1)
    WriteInt(x);
  else
    printf("%i", x);
}
template <typename... Args>
inline void out(int x, Args... args) {
  out(x);
  putc(' ', stdout);
  out(args...);
}
inline void in(int &x) {
  if (IO_MODE & 2)
    x = ReadInt();
  else
    scanf("%i", &x);
}
template <typename... Args>
inline void in(int &x, Args &...args) {
  in(x);
  in(args...);
}
inline void outll(long long x) {
  if (IO_MODE & 1)
    WriteInt(x);
  else
    printf("%I64d", x);
}
template <typename... Args>
inline void outll(long long x, Args... args) {
  outll(x);
  putc(' ', stdout);
  outll(args...);
}
inline void inll(long long &x) {
  if (IO_MODE & 2)
    x = ReadInt();
  else
    scanf("%I64d", &x);
}
template <typename... Args>
inline void inll(long long &x, Args &...args) {
  inll(x);
  inll(args...);
}
int aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk, mm, nn, oo, pp, qq, rr, ss, tt,
    uu, vv, ww, xx, yy, zz;
int tc;
string s, t;
int nxt[100010];
vector<int> prefixFunction(string pat) {
  int m = pat.length();
  vector<int> longestPrefix(m);
  for (int i = 1, k = 0; i < m; i++) {
    while (k > 0 && pat[k] != pat[i]) {
      k = longestPrefix[k - 1];
    }
    if (pat[k] == pat[i])
      longestPrefix[i] = ++k;
    else
      longestPrefix[i] = k;
  }
  return longestPrefix;
}
void kmp(string str, string pat) {
  int n = str.length();
  int m = pat.length();
  vector<int> longestPrefix = prefixFunction(pat);
  for (int i = 0, k = 0; i < n; i++) {
    while (k > 0 && pat[k] != str[i]) {
      k = longestPrefix[k - 1];
    }
    if (pat[k] == str[i]) k++;
    if (k == m) {
      nxt[i - m + 1] = i + 1;
      k = longestPrefix[k - 1];
    }
  }
}
long long memo[100010][2];
long long dp(int idx, int has) {
  if (idx == s.size()) return 1;
  if (memo[idx][has] != -1) return memo[idx][has];
  long long ret = 0;
  if (nxt[idx]) ret = (ret + dp(nxt[idx], 1)) % 1000000007;
  if (has)
    ret = (ret + dp(idx + 1, 1) + dp(idx + 1, 0)) % 1000000007;
  else
    ret = (ret + dp(idx + 1, 0)) % 1000000007;
  return memo[idx][has] = ret;
}
int main() {
  cin >> s >> t;
  kmp(s, t);
  for (int i = s.size(); i--;)
    if (!nxt[i]) nxt[i] = nxt[i + 1];
  memset(memo, -1, sizeof memo);
  outll((dp(0, 0) - 1 + 1000000007) % 1000000007);
  putc('\n', stdout);
}
