#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e3, mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long reversenum(long long nb) {
  long long sum = 0;
  while (nb != 0) {
    sum = sum * 10 + nb % 10;
    nb /= 10;
  }
  return sum;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  n++;
  long long nm;
  vector<long long> ans;
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (i != n - 1) ans.push_back(s.size());
    if (i == n - 1) nm = s.size();
  }
  sort(ans.begin(), ans.end());
  long long m = maxn;
  long long b = 0;
  for (long long i = 0; i < ans.size(); i++) {
    if (nm == ans[i]) {
      m = min(m, i);
      b = max(b, i);
    }
  }
  m++;
  b++;
  if (m > k) {
    long long nc = m / k;
    if (m % k == 0) {
      nc--;
      m = 5 * nc + nc * k + k;
    } else
      m = 5 * nc + nc * k + m % k;
  }
  if (b > k) {
    long long nc = b / k;
    if (b % k == 0) {
      nc--;
      b = 5 * nc + nc * k + k;
    } else
      b = 5 * nc + nc * k + b % k;
  }
  cout << m << " " << b << "\n";
  return 0;
}
