#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int s, e, c, nx, co;
} road[1000000];
int head[1000], cnt, dis[1000], pre[1000], n, m, a[1000], id[1000];
int val[30];
bool in[1000];
queue<int> Q;
void add(int s, int e, int c, int co) {
  road[cnt].s = s;
  road[cnt].e = e;
  road[cnt].c = c;
  road[cnt].co = co;
  road[cnt].nx = head[s];
  head[s] = cnt++;
  swap(s, e);
  c = 0;
  co = -co;
  road[cnt].s = s;
  road[cnt].e = e;
  road[cnt].c = c;
  road[cnt].nx = head[s];
  road[cnt].co = co;
  head[s] = cnt++;
}
void spfa(int s) {
  for (int i = 0; i < 1000; i++) dis[i] = 0x3f3f3f3f;
  memset(in, 0, sizeof(in));
  in[s] = 1;
  dis[s] = 0;
  while (!Q.empty()) Q.pop();
  Q.push(s);
  while (!Q.empty()) {
    int x = Q.front();
    Q.pop();
    in[x] = 0;
    for (int i = head[x]; ~i; i = road[i].nx)
      if (road[i].c) {
        int e = road[i].e;
        if (dis[e] > dis[x] + road[i].co) {
          dis[e] = dis[x] + road[i].co;
          pre[e] = i;
          if (!in[e]) {
            Q.push(e);
            in[e] = 1;
          }
        }
      }
  }
}
int mincost(int s, int e) {
  int ans = 0;
  while (1) {
    spfa(s);
    if (dis[e] == 0x3f3f3f3f) break;
    int now = e;
    int mi = 0x3f3f3f3f;
    while (now != s) {
      mi = min(mi, road[pre[now]].c);
      now = road[pre[now]].s;
    }
    now = e;
    while (now != s) {
      road[pre[now]].c -= mi;
      road[pre[now] ^ 1].c += mi;
      now = road[pre[now]].s;
    }
    ans += mi * dis[e];
  }
  return ans;
}
int count(int x) {
  int ans = 0;
  while (x) ans += x & 1, x >>= 1;
  return ans;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  cnt = 0;
  memset(head, -1, sizeof(head));
  int s = 0, t = 2 * n + 2, temp = t - 1;
  add(s, temp, m, 0);
  for (int i = 1; i <= n; i++) add(s, 2 * i - 1, 1, 0);
  for (int i = 1; i <= n; i++) add(temp, 2 * i, 1, count(a[i]));
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      int co;
      if (a[j] == a[i])
        co = 0;
      else
        co = count(a[j]);
      add(2 * i - 1, 2 * j, 1, co);
    }
  for (int i = 1; i <= n; i++) add(2 * i, t, 1, 0);
  int ans = mincost(s, t);
  memset(pre, -1, sizeof(pre));
  for (int i = head[temp]; ~i; i = road[i].nx) {
    if (road[i].c == 0) {
      pre[road[i].e / 2] = 0;
    }
  }
  for (int j = 1; j <= n; j++) {
    for (int i = head[2 * j - 1]; ~i; i = road[i].nx) {
      if (road[i].c == 0) {
        pre[road[i].e / 2] = j;
      }
    }
  }
  int cao = 0;
  int use = 0;
  memset(val, -1, sizeof(val));
  for (int i = 1; i <= n; i++) {
    if (pre[i] == 0)
      id[i] = use++;
    else
      id[i] = id[pre[i]];
    if (a[i] != val[id[i]]) cao++;
    val[id[i]] = a[i];
    cao++;
  }
  printf("%d %d\n", cao, ans);
  use = 0;
  memset(val, -1, sizeof(val));
  for (int i = 1; i <= n; i++) {
    if (pre[i] == 0)
      id[i] = use++;
    else
      id[i] = id[pre[i]];
    if (a[i] != val[id[i]]) printf("%c=%d\n", id[i] + 'a', a[i]);
    val[id[i]] = a[i];
    printf("print(%c)\n", id[i] + 'a');
  }
  return 0;
}
