#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> sizes;
  for (int i = 0; i <= n; i++) {
    string x;
    cin >> x;
    sizes.push_back(x.size());
  }
  int less = 0;
  int eq = 0;
  for (int i = 0; i < n; i++) {
    if (sizes[i] < sizes[n]) {
      less++;
    } else if (sizes[i] == sizes[n]) {
      eq++;
    }
  }
  int best = less + (less / k) * 5 + 1;
  int worst = (less + eq - 1) + ((less + eq - 1) / k) * 5 + 1;
  cout << best << ' ' << worst << endl;
}
