#include <bits/stdc++.h>
using namespace std;
struct mcmf {
  int fst[1020], nxt[200002], vv[200002], cost[200002], cap[200002],
      flow[200002], e;
  int p[1020], inq[1020], a[1020], d[1020];
  void init() {
    memset(fst, -1, sizeof fst);
    e = 0;
  }
  void add(int u, int v, int c, int d) {
    vv[e] = v, nxt[e] = fst[u], cap[e] = c, flow[e] = 0, cost[e] = d,
    fst[u] = e++;
    vv[e] = u, nxt[e] = fst[v], cap[e] = 0, flow[e] = 0, cost[e] = -d,
    fst[v] = e++;
  }
  bool spfa(int s, int t, int &mf, int &mc) {
    memset(d, 0x3f, sizeof d);
    d[s] = 0, a[s] = 0x3f3f3f3f;
    queue<int> q;
    q.push(s);
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      inq[u] = 0;
      for (int i = fst[u]; ~i; i = nxt[i]) {
        int v = vv[i], c = cost[i];
        if (cap[i] > flow[i] && d[v] > d[u] + c) {
          d[v] = d[u] + c;
          a[v] = min(a[u], cap[i] - flow[i]);
          p[v] = i;
          if (!inq[v]) inq[v] = 1, q.push(v);
        }
      }
    }
    if (d[t] == 0x3f3f3f3f) return 0;
    mf += a[t];
    mc += d[t] * a[t];
    int u = t;
    while (u != s) {
      flow[p[u]] += a[t];
      flow[p[u] ^ 1] -= a[t];
      u = vv[p[u] ^ 1];
    }
    return 1;
  }
  int gao(int s, int t) {
    int mf = 0, mc = 0;
    while (spfa(s, t, mf, mc))
      ;
    return mc;
  }
} go;
int n, m;
int a[1020];
map<int, int> pre;
int num[1020];
int calc(int x) {
  int ret = 0;
  while (x) {
    ret++;
    x -= x & -x;
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  int s = 0, t = 3 * n + 1;
  go.init();
  go.add(s, 1, m, 0);
  for (int i = 1; i <= n; ++i) {
    go.add(i, i == n ? t : i + 1, m, 0);
    go.add(i, i + n, 1, calc(a[i]));
    go.add(i + n, i + 2 * n, 1, -1000000);
    go.add(i + 2 * n, i == n ? t : i + 1, 1, 0);
  }
  for (int i = n; i >= 1; --i) {
    if (pre.count(a[i])) {
      go.add(i + 2 * n, pre[a[i]] + n, 1, 0);
    }
    pre[a[i]] = i;
  }
  int mc = go.gao(s, t) + n * 1000000;
  vector<pair<int, int> > ans;
  memset(num, -1, sizeof num);
  for (int i = 1; i <= n; ++i) {
    int f = 0;
    for (int k = 1; k <= m; ++k) {
      if (num[k] == a[i]) {
        f = k;
        break;
      }
    }
    if (!f) {
      for (int k = 1; k <= m; ++k) {
        if (num[k] == -1) {
          ans.push_back(make_pair(-k, a[i]));
          num[k] = a[i];
          f = k;
          break;
        }
      }
    }
    if (f == 0) {
      vector<int> gg;
      gg[1] = -1;
    }
    ans.push_back(make_pair(f, a[i]));
    for (int j = go.fst[i + 2 * n]; ~j; j = go.nxt[j]) {
      int v = go.vv[j];
      if (v == i + 1) {
        if (go.cap[j] == go.flow[j]) {
          for (int k = 1; k <= m; ++k) {
            if (num[k] == a[i]) num[k] = -1;
          }
        }
      }
    }
  }
  printf("%d %d\n", (int)ans.size(), mc);
  for (int i = 0; i < ans.size(); ++i) {
    if (ans[i].first < 0)
      printf("%c=%d\n", -ans[i].first + 'a' - 1, ans[i].second);
    else
      printf("print(%c)\n", ans[i].first + 'a' - 1);
  }
  return 0;
}
