Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n, m := io.NextInt(), io.NextInt()
		if n == 0 {
			break
		}
		a := make([]int, n)
		for i := 0; i < n; i++ {
			a[i] = io.NextInt()
		}
		ans := 0
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				if a[i]+a[j] <= m {
					ans = intMax(a[i]+a[j], ans)
				}
			}
		}
		if ans == 0 {
			io.Println("NONE")
		} else {
			io.Println(ans)
		}
	}
}

func intMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

Python: answer=[]
while True:
    t = 0
    n,m = map(int,input().split())
    if n != 0:
        a = list(map(int,input().split()))
        a.sort()
        for i in range(n - 1):
            k = a[-i-1]
            for j in range(n - i):
                if k + a[-i-j] <= m:
                    if k + a[-i-j] >= t:
                        t = k + a[-i-j]
                    break
        if t == 0:
            answer.append("NONE")
        else:
            answer.append(t)
    else:
        break
for i in range(len(answer)):
    print(answer[i])

Python: s=[]

cnt=0

while 1:
    max=0
    n,m =map(int,input().split())
    l=list(map(int,input().split()))
    if n==0 and m==0:
        break

    for i in range(len(l)):
        for j in range(len(l)):
            if max<l[i]+l[j] and i!=j and m>=l[i]+l[j]:
                max=l[i]+l[j]

    if max==0:
        s+=["NONE"]
    else:
        s+=[max]


for x in s:
    print(x)

Python: while True:
    n,m = map(int,input().split(" "))
    if n == 0:
        break

    items = []
    for i in input().split(" "):
        items.append(int(i))


    #全探索
    items2 = items
    sums = []
    for i in range(len(items)):
        for j in range(len(items)):
            if i == j:
                continue
            sums.append(items[i] + items2[j])

    sums.sort(reverse=True)
    for i in range(len(sums)):
        if sums[i] <= m:
            print(sums[i])
            break
        if i == len(sums) - 1:
            print("NONE")

Python: #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import itertools


def rdp_connect() -> bool:
    global n, m, a
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        return False
    a = list(map(int, input().split()))
    return True


if __name__ == '__main__':
    while rdp_connect():
        lis = filter(lambda e: e <= m, map(sum, itertools.combinations(a, 2)))
        try:
            print(max(lis))
        except ValueError:
            print('NONE')

Python: answer=[]
while True:
    t = 0
    n,m = map(int,input().split())
    if n != 0:
        a = list(map(int,input().split()))
        a.sort()
        for i in range(n - 1):
            k = a[-i-1]
            for j in range(n - i):
                if k + a[-i-1-j] <= m:
                    if k + a[-i-1-j] >= t:
                        t = k + a[-i-1-j]
                    break
        if t == 0:
            answer.append("NONE")
        else:
            answer.append(t)
    else:
        break
for i in range(len(answer)):
    print(answer[i])

Python: while True:
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    else:
        s=sorted(list(map(int,input().split())))
        ans=0
        for i in range(n):
            for j in reversed(range(i+1,n)):
                if s[i]+s[j]>m:
                    continue
                else:
                    ans=max(ans,s[i]+s[j])
                    break
        if ans==0:
            print("NONE")
        else:
            print(ans)

Python: while True:
   n,m = map(int, input().split())
   if n==0 and m==0:
      break
   a = list(map(int, input().split()))
   s = []
   for p in range(n):
      for q in range(n):
         if p >= q:
            pass
         else:
            if a[p] + a[q] <= m:
               s.append(a[p] + a[q])
   s.sort()
   if s == []:
      print('NONE')
   else:
      print(s[len(s)-1])

Python: import numpy as np
ans=[]
for i in range(50000):
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    else:
        A=list(map(int,input().split(' ')))
        sum=0
        max=0
        for j in range(len(A)):
            for k in range(len(A)):
                if j!=k:
                    sum=A[j]+A[k]
                    if sum>=max and sum<=m:
                        max=sum
        if max==0:
            max="NONE"
        ans.append(max)
for i in range(len(ans)):
    if ans[i]!=0:
        print(ans[i])
    else:
        break

Python: while True:
  n,m = map(int,input().split())
  if n+m==0:
    break
  a = list(map(int,input().split()))
  ans = -1
  for i in range(n-1):
    for j in range(i+1,n):
      ans = max(a[i]+a[j],ans) if a[i]+a[j]<=m else ans
  print("NONE" if ans==-1 else ans)

Python: s=[]
cnt=0
while 1:
    n,m=map(int,input().split())

    if n==0 and m==0:
        break
    a=list(int(i) for i in input().split())
    max=0

    for i in range(n):
     for j in range(1,n-1):
        c=a[i]+a[j]
        if max<=c and c<=m:
            max=c    
    if max==0:
        s.append(0)
    else: 
        s.append(max)
    a=[0]
    cnt=cnt+1

for i in range(cnt):
    if s[i]==0:
        print("none")
    else:
        print(s[i])

Python: #!/usr/bin/env python3
while True:
    n, m = map(int, input().split())
    if n == 0:
        exit()
    a = list(map(int, input().split()))
    ans = -1
    for i in range(n):
        for j in range(n):
            if i == j: continue
            s = a[i] + a[j]
            if s <= m:
                ans = max(ans, s)
    print([ans, 'NONE'][ans == -1])

Python: 
A=map(int,input().split())
n=int(A[0])
m=int(A[1])


max=[]
k=0
while n>0 and m>0:
    B=[0 for i in range(n)]
    B=input().split()
    for i in range(n):
        B[i]=int(B[i])
    ma=0
    for i in range(n):
        for j in range(i+1,n):  
            x=0 
            x=B[i]+B[j]
            if ma<x and x<=m:
                ma=x
    max.append(ma)
    A=input().split()
    n=int(A[0])
    m=int(A[1])
    k+=1
for i in range(k):
    if max[i]>0:
        print(max[i])
    else:
        print("NONE")