#include <bits/stdc++.h>
using namespace std;
struct MCF {
  int V, E, tf, tc;
  vector<int> la, nxt, oppo, capa, cost;
  void init(int V_) {
    V = V_;
    E = tf = tc = 0;
    la.clear();
    nxt.clear();
    oppo.clear();
    capa.clear();
    cost.clear();
    la = vector<int>(V, -1);
  }
  void add(int u, int v, int ca, int co) {
    nxt.push_back(la[u]);
    la[u] = E++;
    oppo.push_back(v);
    capa.push_back(ca);
    cost.push_back(co);
  }
  bool spfa(int src, int snk) {
    vector<int> dist(V, 1e9), inq(V, 0), fe(V, -1);
    queue<int> q;
    q.push(src);
    inq[src] = 1;
    dist[src] = 0;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      inq[u] = 0;
      for (int i = la[u]; i != -1; i = nxt[i]) {
        int v = oppo[i];
        if (capa[i] && dist[v] > dist[u] + cost[i]) {
          dist[v] = dist[u] + cost[i];
          fe[v] = i;
          if (!inq[v]) {
            q.push(v);
            inq[v] = 1;
          }
        }
      }
    }
    if (dist[snk] == 1e9) return false;
    tf++;
    tc += dist[snk];
    int u = snk;
    while (u != src) {
      int e = fe[u];
      capa[e]--;
      capa[e ^ 1]++;
      u = oppo[e ^ 1];
    }
    return true;
  }
} mcf;
int N, M;
int A[300], B[300];
int bit_count(int v) {
  int ret = 0;
  while (v) {
    if (v & 1) ret++;
    v >>= 1;
  }
  return ret;
}
vector<pair<int, int> > sol;
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int V = M + 2 * N + 2, src = V - 2, snk = V - 1;
  mcf.init(V);
  for (int i = 0; i < M + N; i++) {
    mcf.add(src, i, 1, 0);
    mcf.add(i, src, 0, 0);
  }
  for (int i = 0; i < N; i++) {
    mcf.add(M + N + i, snk, 1, 0);
    mcf.add(snk, M + N + i, 0, 0);
  }
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      int w = bit_count(A[j]);
      mcf.add(i, M + N + j, 1, w);
      mcf.add(M + N + j, i, 0, -w);
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int w = A[i] == A[j] ? 0 : bit_count(A[j]);
      mcf.add(M + i, M + N + j, 1, w);
      mcf.add(M + N + j, M + i, 0, -w);
    }
  }
  while (mcf.spfa(src, snk))
    ;
  for (int i = 0; i < N; i++) {
    int u = M + N + i;
    for (int j = mcf.la[u]; j != -1; j = mcf.nxt[j]) {
      int v = mcf.oppo[j];
      if (v != snk && mcf.capa[j]) {
        B[i] = v < M ? v : B[v - M];
        if (v < M || A[v - M] != A[i]) {
          sol.push_back({B[i], A[i]});
        }
      }
    }
    sol.push_back({B[i], -1});
  }
  printf("%d %d\n", sol.size(), mcf.tc);
  for (int i = 0; i < sol.size(); i++) {
    if (sol[i].second == -1)
      printf("print(%c)\n", 'a' + sol[i].first);
    else
      printf("%c=%d\n", 'a' + sol[i].first, sol[i].second);
  }
}
