#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
vector<int> ge[502], weight[502], cost[502], anti[502], type[502];
int dist[502], pre[502], path[502], loc[250], a[250], cur[26];
bool v[502];
void insertEdge(int a, int b, int w, int c) {
  anti[a].push_back(ge[b].size());
  anti[b].push_back(ge[a].size());
  ge[a].push_back(b);
  weight[a].push_back(w);
  cost[a].push_back(c);
  type[a].push_back(0);
  ge[b].push_back(a);
  weight[b].push_back(0);
  cost[b].push_back(-c);
  type[b].push_back(1);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    insertEdge(0, i + 1, 1, __builtin_popcount(a[i]));
    insertEdge(i + 1, n + i + 1, 1, -100000);
    insertEdge(n + i + 1, n * 2 + 1, 1, 0);
    for (int j = i + 1; j < n; j++)
      if (a[i] == a[j]) {
        insertEdge(n + i + 1, j + 1, 1, 0);
      } else {
        insertEdge(n + i + 1, j + 1, 1, __builtin_popcount(a[j]));
      }
  }
  int ans = 100000 * n, last = m;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < 2 * n + 2; j++) dist[j] = inf;
    dist[0] = 0;
    memset(v, false, sizeof(v));
    v[0] = true;
    queue<int> Q;
    Q.push(0);
    while (!Q.empty()) {
      int cur = Q.front();
      Q.pop();
      v[cur] = false;
      for (int j = 0; j < ge[cur].size(); j++) {
        if (weight[cur][j] == 0) continue;
        int next = ge[cur][j];
        if (dist[cur] + cost[cur][j] < dist[next]) {
          dist[next] = dist[cur] + cost[cur][j];
          path[next] = j;
          pre[next] = cur;
          if (!v[next]) {
            v[next] = true;
            Q.push(next);
          }
        }
      }
    }
    if (dist[2 * n + 1] > 0) {
      last = i;
      break;
    }
    ans += dist[2 * n + 1];
    for (int j = 2 * n + 1; j != 0; j = pre[j]) {
      weight[pre[j]][path[j]]--;
      weight[j][anti[pre[j]][path[j]]]++;
    }
  }
  for (int i = 0; i < last; i++) {
    int cur = 0;
    while (cur != 2 * n + 1)
      for (int j = 0; j < ge[cur].size(); j++)
        if (type[cur][j] == 0 && weight[cur][j] == 0) {
          weight[cur][j]++;
          cur = ge[cur][j];
          if (1 <= cur && cur <= n) loc[cur - 1] = i;
          break;
        }
  }
  memset(cur, -1, sizeof(cur));
  int tot = 0;
  for (int i = 0; i < n; i++)
    if (cur[loc[i]] != a[i]) {
      cur[loc[i]] = a[i];
      tot++;
    }
  printf("%d %d\n", tot + n, ans);
  memset(cur, -1, sizeof(cur));
  for (int i = 0; i < n; i++) {
    if (cur[loc[i]] != a[i]) {
      cur[loc[i]] = a[i];
      printf("%c=%d\n", loc[i] + 'a', a[i]);
    }
    printf("print(%c)\n", loc[i] + 'a');
  }
  return 0;
}
