#include <bits/stdc++.h>
int n, m;
int a[501];
int b[501];
int head[2001], end[400001], cost[400001], next[400001], tp = -1;
int dis[2001], ans, len[400001], flow, old[2001];
int p[2001], pre[2001];
int q[100001], hh = 1, tt = 0;
int iq[2001];
const int inf = 1 << 30;
int cnt;
inline unsigned ppcnt(unsigned x) {
  x -= ((x & 0xaaaaaaaau) >> 1);
  x = ((x & 0xccccccccu) >> 2) + (x & 0x33333333u);
  x = ((x >> 4) + x) & 0x0f0f0f0fu;
  x = (x * 0x01010101u) >> 24;
  return x;
}
inline void add(int b, int e, int l, int c) {
  next[++tp] = head[b];
  head[b] = tp;
  end[tp] = e;
  len[tp] = l;
  cost[tp] = c;
  next[++tp] = head[e];
  head[e] = tp;
  end[tp] = b;
  len[tp] = 0;
  cost[tp] = -c;
}
int bfs(int s, int t, int b, int e) {
  int i, j, k;
  dis[s] = 0;
  pre[s] = -1;
  for (i = b; i <= e; i++)
    if (i != s) dis[i] = inf;
  hh = 1;
  tt = 0;
  q[++tt] = s;
  iq[s] = 1;
  while (hh <= tt) {
    for (i = head[q[hh]]; i >= 0; i = next[i])
      if (len[i] > 0 && dis[end[i]] > dis[q[hh]] + cost[i]) {
        dis[end[i]] = dis[q[hh]] + cost[i];
        pre[end[i]] = q[hh];
        p[end[i]] = i;
        if (!iq[end[i]]) {
          q[++tt] = end[i];
          iq[end[i]] = 1;
        }
      }
    iq[q[hh]] = 0;
    hh++;
  }
  return dis[t] < inf;
}
int ek_dfs(int s, int t) {
  int i;
  flow = inf;
  for (i = t; pre[i] != -1; i = pre[i]) {
    if (len[p[i]] < flow) flow = len[p[i]];
  }
  for (i = t; pre[i] != -1; i = pre[i]) {
    len[p[i]] -= flow;
    len[p[i] ^ 1] += flow;
    ans += flow * cost[p[i]];
  }
  return flow;
}
void ek(int s, int t, int b, int e) {
  while (bfs(s, t, b, e)) ek_dfs(s, t);
}
int main() {
  int i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(head, -1, sizeof(head));
  for (i = 1; i <= n; i++) {
    for (j = i + 1; j <= n; j++)
      add(i, n + m + j, 1, a[i] == a[j] ? 0 : ppcnt(a[j]));
  }
  for (i = 1; i <= m; i++)
    for (j = 1; j <= n; j++) add(n + i, n + m + j, 1, ppcnt(a[j]));
  for (i = 1; i <= n + m; i++) add(0, i, 1, 0);
  for (i = n + m + 1; i <= n + n + m; i++) add(i, n + n + m + 1, 1, 0);
  ek(0, n + m + n + 1, 0, n + m + n + 1);
  for (i = n + m + 1; i <= n + m + n; i++) {
    for (j = head[i]; j >= 0; j = next[j])
      if (len[j] == 1) {
        if (end[j] > n || end[j] <= n && a[end[j]] != a[i - n - m]) cnt++;
        break;
      }
    cnt++;
  }
  printf("%d %d\n", cnt, ans);
  for (i = n + m + 1; i <= n + m + n; i++) {
    for (j = head[i]; j >= 0; j = next[j])
      if (len[j] == 1) {
        if (end[j] > n) {
          b[i - n - m] = end[j] - n;
          printf("%c=%d\n", (char)b[i - n - m] + 'a' - 1, a[i - n - m]);
        } else {
          b[i - n - m] = b[end[j]];
          if (a[end[j]] != a[i - n - m])
            printf("%c=%d\n", (char)b[i - n - m] + 'a' - 1, a[i - n - m]);
        }
        break;
      }
    printf("print(%c)\n", char(b[i - n - m] + 'a' - 1));
  }
  return 0;
}
