#include <bits/stdc++.h>
using namespace std;
template <typename T>
T mabs(const T &a) {
  return a < 0 ? -a : a;
}
const int SZ = 100050;
int pf[2 * SZ];
void buildPf(const char *str) {
  pf[0] = 0;
  int n = strlen(str);
  for (int i = (1), ei = (n); i < ei; i++) {
    int cv = pf[i - 1];
    while (1) {
      if (str[cv] == str[i]) {
        cv++;
        break;
      }
      if (cv == 0) break;
      cv = pf[cv - 1];
    }
    pf[i] = cv;
  }
}
char s[SZ], t[SZ];
bool starts[SZ]{};
int nextIdx[SZ];
long long MOD = 1000000007;
long long sums[SZ];
long long sums2[SZ];
long long vals[SZ]{};
void run() {
  scanf(" %s %s", s, t);
  string concat = string(t) + "$" + string(s);
  buildPf(concat.c_str());
  int *mpf = pf + strlen(t) + 1;
  int tl = strlen(t);
  int sl = strlen(s);
  nextIdx[0] = -1;
  for (int i = (0), ei = (sl); i < ei; i++) {
    if (mpf[i] == tl) {
      nextIdx[i + 1] = i - tl + 1;
    } else {
      nextIdx[i + 1] = nextIdx[i];
    }
  }
  sums[0] = 1;
  sums2[0] = 1;
  for (int i = (0), ei = (sl); i < ei; i++) {
    if (nextIdx[i + 1] >= 0) vals[i + 1] = sums2[nextIdx[i + 1]];
    sums[i + 1] = (sums[i] + vals[i + 1]) % MOD;
    sums2[i + 1] = sums2[i] + sums[i + 1];
  }
  long long res = sums[sl] - 1;
  res += MOD;
  res %= MOD;
  printf(
      "%l"
      "ld\n",
      res);
}
int main() {
  run();
  return 0;
}
