#include <bits/stdc++.h>
using namespace std;
const int maxn = 300, inf = 1e9;
int n, K, A[maxn];
struct Tcost {
  static const int maxn = 1000, maxm = 500000;
  int S, T, tot;
  int dist, cost;
  struct Tsqy {
    int s, v;
    int c;
    Tsqy *l, *o;
    inline void set(Tsqy *_l, int _s, int _v, int _c) {
      l = _l, s = _s, v = _v, c = _c;
    }
  } * pos[maxn], buf[maxm * 2];
  inline void add(int a, int b, int c, int d) {
    buf[++tot].set(pos[a], b, c, d), buf[tot + 1].o = pos[a] = buf + tot;
    buf[++tot].set(pos[b], a, 0, -d), buf[tot - 1].o = pos[b] = buf + tot;
  }
  int d[maxn];
  Tsqy *f[maxn];
  int h[maxn];
  bool U[maxn];
  inline bool spfa() {
    int l = 0, r = 1, u, v;
    Tsqy *p;
    memset(d, 54, (T + 1) * sizeof d[0]), memset(U, 0, T + 1);
    h[1] = S, U[S] = 1, d[S] = 0;
    for (; l != r;) {
      u = h[l = l % 600 + 1];
      for (p = pos[u]; p; p = p->l)
        if (p->v && d[v = p->s] > d[u] + p->c) {
          d[v] = d[u] + p->c, f[v] = p;
          if (!U[v]) h[r = r % 600 + 1] = v, U[v] = 1;
        }
      U[u] = false;
    }
    return (dist = d[T]) < 700000000;
  }
  void aug() {
    int p, flow = inf;
    for (p = T; p != S; p = f[p]->o->s) flow = min(flow, f[p]->v);
    cost += dist * flow;
    for (p = T; p != S; p = f[p]->o->s) f[p]->v -= flow, f[p]->o->v += flow;
  }
  int mincost() {
    for (cost = 0; spfa(); aug())
      ;
    return cost;
  }
} flow;
namespace Ninit {
int bitlen(int x) {
  int Fc = 0;
  for (; x; x -= x & -x) ++Fc;
  return Fc;
}
void init() {
  int i, j;
  scanf("%d%d", &n, &K);
  for (i = 0; i < n; ++i) scanf("%d", A + i);
  flow.S = 2 * n + 1, flow.T = flow.S + 1;
  flow.add(flow.S, 2 * n, K, 0), flow.add(2 * n, flow.T, K, 0);
  for (i = 0; i < n; ++i)
    for (j = i + 1; j < n; ++j)
      flow.add(i + n, j, 1, A[i] != A[j] ? bitlen(A[j]) : 0);
  for (i = 0; i < n; ++i) {
    flow.add(i, i + n, 1, -8000);
    flow.add(2 * n, i, 1, bitlen(A[i]));
    flow.add(i + n, flow.T, 1, 0);
  }
}
}  // namespace Ninit
namespace Nsolve {
struct Tans {
  int n;
  struct Tsqy {
    int k, x, y;
  } a[1000];
  static inline bool cmp(const Tsqy &a, const Tsqy &b) {
    return a.y != b.y ? a.y < b.y : a.k < b.k;
  }
  inline void push(int k, int x, int y) {
    a[n].k = k, a[n].x = x, a[n].y = y, n++;
  }
  inline void sortit() { sort(a, a + n, cmp); }
} H;
int ans;
namespace Nconstrc {
int N;
void solve() {
  Tcost::Tsqy *p, *q, *t;
  int i, j;
  for (N = 0, p = flow.pos[2 * n]; p; p = p->l) {
    if (p->s < 0 || p->s >= n || p->v) continue;
    for (t = p, i = p->s; i != flow.T;) {
      if (t->c) H.push(0, N, i);
      H.push(1, N, i);
      for (q = flow.pos[i + n]; q; q = q->l)
        if (!q->v) {
          t = q, i = q->s;
          break;
        }
    }
    N++;
  }
}
}  // namespace Nconstrc
void solve() {
  int i;
  Tans::Tsqy *p;
  ans = flow.mincost() + 8000 * n;
  Nconstrc::solve();
  H.sortit(), printf("%d %d\n", H.n, ans);
  for (p = H.a; p < H.a + H.n; ++p) {
    p->k ? printf("print(%c)\n", (char)p->x + 'a')
         : printf("%c=%d\n", (char)p->x + 'a', A[p->y]);
  }
}
}  // namespace Nsolve
int main() {
  Ninit::init();
  Nsolve::solve();
  return 0;
}
