#include <bits/stdc++.h>
using namespace std;
long long int minn(long long int a, long long int b) { return a < b ? a : b; }
long long int maxx(long long int a, long long int b) { return a > b ? a : b; }
long long int cill(long long int a, long long int b) {
  if (a % b == 0) return a / b;
  return a / b + 1;
}
long long int abss(long long int a) {
  if (a >= 0)
    return a;
  else
    return -1 * (a);
}
long double get_angle(pair<int, int> a, pair<int, int> b, pair<int, int> c) {
  int x1 = a.first;
  int y1 = a.second;
  int x2 = b.first;
  int y2 = b.second;
  int x3 = c.first;
  int y3 = c.second;
  long double len1 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  long double len2 = sqrt((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2));
  long double val =
      ((x1 - x2) * (x3 - x2) + (y1 - y2) * (y3 - y2)) / (len1 * len2);
  return acos(val);
}
long double find_point_dis(pair<int, int> point1, pair<int, int> point2) {
  long double temp_ans;
  temp_ans = ((point1.first - point2.first) * (point1.first - point2.first));
  temp_ans +=
      ((point1.second - point2.second) * (point1.second - point2.second));
  return sqrt(temp_ans);
}
int check_sidde(pair<int, int> p1, pair<int, int> p2, pair<int, int> p3) {
  int x1 = p1.first;
  int y1 = p1.second;
  int x2 = p2.first;
  int y2 = p2.second;
  int x3 = p3.first;
  int y3 = p3.second;
  long long int ans = (x3 - x1) * (y1 - y2) - (y3 - y1) * (x1 - x2);
  if (ans >= 0)
    return 1;
  else
    return -1;
}
long long int cnt_div(long long int n, long long int k) {
  long long int cnt = 0;
  while (n % k == 0) {
    cnt++;
    n /= k;
  }
  return cnt;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  long long int g = gcd(a, b);
  return (a * b) / g;
}
bool check(string s, string t) {
  if (t.size() > s.size()) return false;
  if (s.size() % t.size()) return false;
  int i = 0;
  int j = t.size() - 1;
  string temp;
  while (j < s.size()) {
    temp.clear();
    for (int k = i; k <= j; k++) temp.push_back(s[k]);
    if (temp == t) {
      i = j + 1;
      j = i + t.size() - 1;
    } else
      return false;
  }
  return true;
}
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  map<int, int> counter;
  for (int i = 0; i < n; i++) {
    cin >> s;
    counter[s.size()]++;
  }
  string password;
  cin >> password;
  int ans = 0;
  for (int i = 1; i < password.size(); i++) ans += counter[i];
  int bestcase = ans + (ans / k) * 5 + 1;
  int worstcase = ans + counter[password.size()] - 1;
  worstcase += ((worstcase / k) * 5);
  worstcase++;
  cout << bestcase << " " << worstcase << endl;
}
int main() { solve(); }
