#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && (c != '-')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
namespace MCMF {
const int N = 1010, M = 1e5 + 10;
const long long inf = 1e15;
int tot = -1, first[N], to[M << 1], last[M << 1], flow[M << 1];
long long cost[M << 1];
inline void init() { memset((first), (-1), sizeof(first)); }
inline void add(int x, int y, int w, long long f) {
  to[++tot] = y, flow[tot] = w, cost[tot] = f, last[tot] = first[x],
  first[x] = tot;
}
inline void Add(int x, int y, int w, long long f) {
  add(x, y, w, f), add(y, x, 0, -f);
}
long long dis[N], Flow[N];
int pre[N], pos[N];
bool vis[N];
inline bool spfa(int s, int t) {
  for (register int i = (s); i <= (t); i++) vis[i] = 0, dis[i] = Flow[i] = inf;
  queue<int> q;
  q.push(s), dis[s] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop(), vis[u] = 0;
    for (int i = first[u]; i != -1; i = last[i]) {
      int v = to[i];
      if (dis[u] + cost[i] < dis[v] && flow[i]) {
        dis[v] = dis[u] + cost[i], Flow[v] = min(Flow[u], (long long)flow[i]),
        pre[v] = u, pos[v] = i;
        if (!vis[v]) q.push(v), vis[v] = 1;
      }
    }
  }
  return dis[t] != inf;
}
long long MaxFlow, MinCost;
inline void solve(int s, int t) {
  while (spfa(s, t)) {
    MaxFlow += Flow[t], MinCost += Flow[t] * dis[t];
    for (int i = t; i != s; i = pre[i])
      flow[pos[i]] -= Flow[t], flow[pos[i] ^ 1] += Flow[t];
  }
}
}  // namespace MCMF
using MCMF::Add;
using MCMF::cost;
using MCMF::flow;
using MCMF::tot;
const int N = 350;
int n, m, a[N], id[N][2], pos[N][N], p[N];
struct node {
  int opt, x, y;
};
int main() {
  MCMF::init();
  n = read(), m = read();
  for (register int i = (1); i <= (n); i++) a[i] = read();
  int S = 1, cnt = 1;
  id[0][0] = ++cnt;
  for (register int i = (1); i <= (n); i++) id[i][0] = ++cnt, id[i][1] = ++cnt;
  int T = ++cnt;
  Add(S, id[0][0], m, 0);
  for (register int i = (1); i <= (n); i++) {
    pos[i][0] = tot + 1;
    Add(S, id[i][0], 1, 0), Add(id[i][1], T, 1, 0);
  }
  for (register int i = (0); i <= (n); i++)
    for (register int j = (i + 1); j <= (n); j++) {
      pos[i][j] = tot + 1;
      Add(id[i][0], id[j][1], 1, (a[i] == a[j] ? 0 : __builtin_popcount(a[j])));
    }
  MCMF::solve(S, T);
  vector<node> ans;
  int now = 0;
  for (register int i = (1); i <= (n); i++) {
    bool flag = 0;
    for (register int j = (1); j < (i); j++)
      if (!flow[pos[j][i]]) {
        if (cost[pos[j][i]]) ans.push_back((node){0, p[j], a[i]});
        ans.push_back((node){1, p[j]}), p[i] = p[j];
        flag = 1;
        break;
      }
    if (flag) continue;
    p[i] = ++now;
    ans.push_back((node){0, now, a[i]});
    ans.push_back((node){1, now});
  }
  printf("%d %lld\n", ((int)(ans).size()), MCMF::MinCost);
  for (auto i : ans) {
    if (i.opt == 0)
      printf("%c=%d\n", i.x + 'a' - 1, i.y);
    else
      printf("print(%c)\n", i.x + 'a' - 1);
  }
}
